package com.example.demo.smartLamp.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

/**
 * 
 * @TableName alarm
 */
@TableName(value ="alarm")
@Data
public class Alarm implements Serializable {
    /**
     * 报警表id
     */
    @TableId(type = IdType.AUTO)
    private Integer alarmId;

    /**
     * 灯id
     */
    private Integer lampId;

    /**
     * 0表示正常，1表示报警
     */
    private Integer alarmState;

    /**
     * 报警时间（报警状态转换时间，当设备从报警到不报警状态的时间也记录）
     */
    private Date alarmTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Alarm other = (Alarm) that;
        return (this.getAlarmId() == null ? other.getAlarmId() == null : this.getAlarmId().equals(other.getAlarmId()))
            && (this.getLampId() == null ? other.getLampId() == null : this.getLampId().equals(other.getLampId()))
            && (this.getAlarmState() == null ? other.getAlarmState() == null : this.getAlarmState().equals(other.getAlarmState()))
            && (this.getAlarmTime() == null ? other.getAlarmTime() == null : this.getAlarmTime().equals(other.getAlarmTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getAlarmId() == null) ? 0 : getAlarmId().hashCode());
        result = prime * result + ((getLampId() == null) ? 0 : getLampId().hashCode());
        result = prime * result + ((getAlarmState() == null) ? 0 : getAlarmState().hashCode());
        result = prime * result + ((getAlarmTime() == null) ? 0 : getAlarmTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", alarmId=").append(alarmId);
        sb.append(", lampId=").append(lampId);
        sb.append(", alarmState=").append(alarmState);
        sb.append(", alarmTime=").append(alarmTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}